package com.game.astd.web;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;

import com.game.astd.web.entity.JsonOpt;

public class SpritAction
{
	public JsonOpt<Boolean> login(String username,String password)
	{
		Map<String, String> map = LoginUnit.login(username,password);
		JsonOpt<Boolean> jo = new JsonOpt<Boolean>(false);
		jo.setSuccess(false);
		try
		{
			if(map != null)
			{
				jo.setSuccess(true);
				WebContext webContext = WebContextFactory.get();  
				HttpSession session = webContext.getSession();
				HttpServletRequest request=webContext.getHttpServletRequest(); 
				HttpServletResponse response=webContext.getHttpServletResponse();
				request.getSession().setAttribute("userinfo", map);
			}
			jo.setObj(true);
		} catch (Exception e)
		{
			
		}
		return jo;
	}
}
